<!--
  ~ 版权所有 (c) 2021. 写Bug的小杜 <https://github.com/shaoxiongdu>  保留所有权利
  -->

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="admin/_fragments :: head(~{::title})">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>网站访问记录</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
  <link rel="stylesheet" href="../../static/css/me.css">
</head>
<body>

  <!--导航-->
  <nav th:replace="admin/_fragments :: menu(5)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >

  </nav>

  <!--中间内容-->
  <div  class=" m-padded-tb-big">
    <div class="ui container">

      <form th:action="@{/admin/searchWebsiteRecordByAddress}">
      <div  class="ui secondary segment form">
        <div  class="inline fields">
          <div class="field">
            <input class="right aligned" type="text" name="address" placeholder="地区" th:value="${address}">
          </div>
          <div class="field">
            <button  type="submit"  class="ui right aligned mini teal basic button"><i class="search icon"></i>搜索</button>
          </div>
        </div>

      </div>
      </form>

      <div class="ui top attached segment">
        <div class="ui middle aligned two column grid">
          <div class="column">
            <h3 class="ui header">访问记录</h3>
          </div>
          <div class="right aligned column">
            <h3><span> 共 <h2 class="ui orange header m-inline-block " th:text="${recordListSize}"></h2>条访问数据</span></h3>
          </div>
        </div>
      </div>

        <table  class="ui celled attached compact teal table">
          <thead>

          <tr align="center">
            <th>记录ID</th>
            <th>访问总次数</th>
            <th>IP地址</th>
            <th>地区</th>
            <th>上次访问时间</th>
          </tr>
          </thead>
          <tbody>
          <tr align="center" th:each="record : ${recordList}">
            <td th:text="${record.id}"></td>
            <td th:text="${record.totalNumberOfVisits}+'次'"></td>
            <td th:text="${record.ip}"></td>
            <td th:text="${record.address}"></td>
            <td th:text="${#dates.format(record.lastVisitTime,'yyyy-MM-dd  HH:mm:ss')}"></td>
          </tr>
          </tbody>

        </table>

    </div>
  </div>

  <br>
  <br>
  <!--底部footer-->
  <footer th:replace="admin/_fragments :: footer" class="ui inverted vertical segment m-padded-tb-massive">

  </footer>

  <!--/*/<th:block th:replace="_fragments :: script">/*/-->
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
  <!--/*/</th:block>/*/-->
  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
          .transition('fade');
      });

    $('#clear-btn')
      .on('click', function() {
        $('.ui.type.dropdown')
          .dropdown('clear')
        ;
      })
    ;

    function page(obj) {
      $("[name='page']").val($(obj).data("page"));
      loaddata();
    }

    $("#search-btn").click(function () {
      $("[name='page']").val(0);
      loaddata();
    });
    function loaddata() {
      $("#table-container").load(/*[[@{/admin/blogs/search}]]*/"/admin/blogs/search",{
        title : $("[name='title']").val(),
        typeId : $("[name='typeId']").val(),
        recommend : $("[name='recommend']").prop('checked'),
        page : $("[name='page']").val()
      });
    }

  </script>
</body>
</html>